<template>
  <div id="app">
    <Header ></Header>
    <router-view :key="cpKey"/>
    <Footer></Footer>
    <Login @uploadHeader="uploadHeader"></Login>
  </div>
</template>

<script>
import Header from "@/components/Header.vue";
import Footer from "./components/Footer.vue";
import Login from "@/components/Login.vue";
export default{
  data(){
    return {
      componentKey:1,
      cpKey:1,
    }
  },
  components:{
    Header,
    Footer,
    Login,
  },
  methods:{
    uploadHeader(){
      this.componentKey++;
    }
  },
  watch:{
    '$route.query':{
      handler(n,o){
        if(this.$route.query.code){
          this.componentKey++;
        }
      },
      deep:true
    },
    '$route.params':{
      handler(n,o){
        if(this.$route.params.id){
          this.cpKey++;
        }
      },
      deep:true,
    }
  }
}
</script>
<style lang="less">
@import "https://at.alicdn.com/t/font_2730880_ylrio3ahhx.css";

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
    // &.router-link-exact-active {
    //    color: #42b983;
    // }
  }
}
</style>
